title: “Assignment 1” author: “Natalia Kalashnikova” date: “01 10 2017” output: html_document
## Exercise 1
Git saves all information about data changes. I dont see the difference between R and RStudio.
## Exercise 2
```r possible_outcomes <- c(0, 1, 2, 3, 4, 5) outcome_probabilities <- c(0.1, 0.5, 0.2, 0.1, 0.05, 0.05) n_data_points <- 400 fake_data_points <- sample (possible_outcomes, n_data_points, replace=T, prob=outcome_probabilities) set.seed(NULL)
fake_data_set <- tibble::data_frame(Fake measurement=fake_data_points) ```
r ggplot2::ggplot(fake_data_set, ggplot2::aes(x=`Fake measurement`)) + ggplot2::geom_histogram(bins=5, colour="black", fill="lightgrey")
vue que sur laxe horizontale je vois les significations de possible_outcomes je suppose que ca signifie la liste des résultats possibles outcome_probabilities - Wikipedia dit que outcomes peuvent se rencontrer probabilities qui sont entre 0 et 1 n_data_points peut signifier laxe y - la limite jusqu’a laquelle on peut avoir les resultats set.seed est une fonction qui sert à créer des simulations des objets aléatoires quon peut reproduire (selon les recherches sur Internet)
## Exercise 3
r iris_groups23 <- dplyr::filter(iris, Species %in% c("versicolor", "virginica")) ggplot2::ggplot(iris_groups23, ggplot2::aes(x=Sepal.Width)) + ggplot2::geom_histogram(colour="black", fill="lightgrey", binwidth=0.1) + ggplot2::facet_grid(Species ~ .)
r library(magrittr) iris_versicolor_subset <- dplyr::filter(iris, Sepal.Width <= 2.5, Species == "versicolor") %>% dplyr::select(Sepal.Width, Species) knitr::kable(iris_versicolor_subset)
Sepal.Width Species
     2.3  versicolor 
     2.4  versicolor 
     2.0  versicolor 
     2.2  versicolor 
     2.2  versicolor 
     2.5  versicolor 
     2.5  versicolor 
     2.4  versicolor 
     2.4  versicolor 
     2.3  versicolor 
     2.5  versicolor 
     2.3  versicolor 
     2.5  versicolor 
knitr::include_graphics("20171010_113349.jpg")

iris_groups23 <- dplyr::filter(iris, Species %in% c("versicolor", "virginica"))
ggplot2::ggplot(iris_groups23, ggplot2::aes(x=Sepal.Width)) +
  ggplot2::geom_histogram(colour="black", fill="lightgrey", binwidth=0.1)

Exercise 4

ggplot2::ggplot(stressshift::stress_shift_permit,
                ggplot2::aes(x=Category, fill=Syllable)) +
  ggplot2::geom_bar(position="dodge", colour="black") + 
  ggplot2::scale_fill_brewer(palette="Set3")

ggplot2::ggplot(stressshift::stress_shift_permit, ggplot2::aes(x=0, fill=Syllable)) +
  ggplot2::geom_bar(position="dodge", colour="black") + 
  ggplot2::scale_fill_brewer(palette="Set3") +
  ggplot2::xlab("") +
  ggplot2::theme(axis.text.x=ggplot2::element_blank(),
                 axis.ticks.x=ggplot2::element_blank()) +
  ggplot2::xlim(c(-1,1))

Exercise 5

library(magrittr)
set.seed(1)
ver_balanced <- languageR::ver %>%
  dplyr::group_by(SemanticClass) %>%
  dplyr::sample_n(198)
set.seed(NULL)
ggplot2::ggplot(ver_balanced, ggplot2::aes(x=Frequency)) +
  ggplot2::geom_histogram(fill="lightgrey", colour="black", binwidth=250) +
  ggplot2::facet_grid(SemanticClass ~ .)